<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.5"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>SWM34S_LVGL7.11_SWMUI: C:/Users/DELL/Desktop/Commit/lvgl/SWM34S_LVGL7.11_SWMUI_20230515/APP/BSP/bsp_init.c 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">SWM34S_LVGL7.11_SWMUI<span id="projectnumber">&#160;V7.9</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.5 -->
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_0ca16891106f5a3e9ad635a0d6c5f98f.html">APP</a></li><li class="navelem"><a class="el" href="dir_4ca18d753a70f6eada20fde478bd3fc8.html">BSP</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle"><div class="title">bsp_init.c</div></div>
</div><!--header-->
<div class="contents">
<a href="bsp__init_8c.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span> </div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span><span class="preprocessor">#include &quot;<a class="code" href="bsp__init_8h.html">bsp_init.h</a>&quot;</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span> </div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno">   24</span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="bsp__init_8c.html#a1aedc31e8cff26709d3089c0a7579121">nvic_init</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno">   25</span> </div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"><a class="line" href="bsp__init_8c.html#ac1d41f544770121f1cb61aeb64e5807e">   29</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="bsp__init_8c.html#ac1d41f544770121f1cb61aeb64e5807e">bsp_init</a>(<span class="keywordtype">void</span>)</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno">   30</span>{</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno">   31</span>    <span class="comment">/* 已在 startup_SWM341.s 的 Reset_Handler 中调用</span></div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno">   32</span><span class="comment">    SystemInit();</span></div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno">   33</span><span class="comment">    sfc_init();   //初始化总线上外挂的SPI-Flash, 将其映射至MCU内部(可选外设)</span></div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno">   34</span><span class="comment">    sdram_init(); //初始化总线上外挂的SDRAM&lt;芯片内置&gt;, 将其映射至MCU内部(可选外设)</span></div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno">   35</span><span class="comment">    */</span></div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno">   36</span> </div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno">   37</span>    <span class="comment">//__disable_irq();</span></div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno">   38</span>    <a class="code hl_function" href="bsp__init_8c.html#a1aedc31e8cff26709d3089c0a7579121">nvic_init</a>();</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno">   39</span> </div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno">   40</span>    <a class="code hl_function" href="dev__systick_8c.html#ac816b9d61dad1fe749c8eb4c625320dd">systick_init</a>();</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno">   41</span>    <a class="code hl_function" href="dev__uart_8c.html#afd092ef1d390fe16bc90e101bbbca1d8">uart_debug_init</a>();</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno">   42</span>    <a class="code hl_function" href="dev__jpeg_8c.html#a036588013ef5d04b04f06e8ecd22262e">jpeg_init</a>();</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno">   43</span>    <a class="code hl_function" href="dev__crc_8c.html#af9273c2c56ccb1b14946a43defe57f6b">crc_init</a>();</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno">   44</span>    USBH_HW_Init();</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno">   45</span>    <a class="code hl_function" href="dev__dac_8c.html#a6e622fafee8436bf9cf9f6b120352e3c">dac_init</a>();</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno">   46</span>    __enable_irq();</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno">   47</span>}</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno">   48</span> </div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"><a class="line" href="bsp__init_8c.html#a1aedc31e8cff26709d3089c0a7579121">   52</a></span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="bsp__init_8c.html#a1aedc31e8cff26709d3089c0a7579121">nvic_init</a>(<span class="keywordtype">void</span>)</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno">   53</span>{</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno">   54</span>    <span class="comment">/* 分组默认为 0 (注意这里和 ST 的 NVIC_PriorityGroup_0 宏不是一个意思,请勿混淆), 设为 0 表示全部为抢占优先级, 无子优先级</span></div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno">   55</span><span class="comment">     * SWM341 使用 __NVIC_PRIO_BITS == 3 bit, 支持 4 种优先级分组(0 ~ 3), 8级优先级(0 ~ 7)</span></div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno">   56</span><span class="comment">     * 如无必要, 请勿调整优先级分组, 默认分组即可应用 RTOS.</span></div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno">   57</span><span class="comment">     */</span></div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno">   58</span> </div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno">   59</span>    <span class="comment">/* NVIC_SetPriorityGrouping(0); //优先级分组设定, 只需要被调用一次，一旦分组确定就最好不要更改，否则容易造成程序分组混乱 */</span></div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno">   60</span>    <span class="comment">/* NVIC_SetPriority(IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), PreemptPriority, SubPriority)); //抢断/子 优先级设定(总) */</span></div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno">   61</span>    </div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno">   62</span>    <span class="comment">/* 使能 LCD 中断后再考虑打开此注释</span></div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno">   63</span><span class="comment">    NVIC_SetPriority(LCD_IRQn,    NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 0, 0));</span></div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno">   64</span><span class="comment"></span> </div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno">   65</span><span class="comment">    NVIC_SetPriority(BTIMR0_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 1, 0));</span></div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno">   66</span><span class="comment">    NVIC_SetPriority(BTIMR1_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 1, 0));</span></div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno">   67</span><span class="comment">    </span></div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno">   68</span><span class="comment">    NVIC_SetPriority(GPIOM_IRQn,  NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 1, 0));</span></div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno">   69</span><span class="comment">    NVIC_SetPriority(GPIOD_IRQn,  NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 1, 0));</span></div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno">   70</span><span class="comment">    </span></div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno">   71</span><span class="comment">    NVIC_SetPriority(UART0_IRQn,  NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 1, 0));</span></div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno">   72</span><span class="comment">    </span></div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno">   73</span><span class="comment">    NVIC_SetPriority(JPEG_IRQn,   NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 1, 0));</span></div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno">   74</span><span class="comment">    NVIC_SetPriority(DMA_IRQn,    NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 1, 0));</span></div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno">   75</span><span class="comment">    NVIC_SetPriority(USB_IRQn,    NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 1, 0));</span></div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno">   76</span><span class="comment">    */</span></div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno">   77</span>}</div>
<div class="ttc" id="absp__init_8c_html_a1aedc31e8cff26709d3089c0a7579121"><div class="ttname"><a href="bsp__init_8c.html#a1aedc31e8cff26709d3089c0a7579121">nvic_init</a></div><div class="ttdeci">static void nvic_init(void)</div><div class="ttdoc">对用户使用的可编程硬件中断设置优先级及分组</div><div class="ttdef"><b>Definition:</b> <a href="bsp__init_8c_source.html#l00052">bsp_init.c:52</a></div></div>
<div class="ttc" id="absp__init_8c_html_ac1d41f544770121f1cb61aeb64e5807e"><div class="ttname"><a href="bsp__init_8c.html#ac1d41f544770121f1cb61aeb64e5807e">bsp_init</a></div><div class="ttdeci">void bsp_init(void)</div><div class="ttdoc">初始化所有的硬件设备, 该函数配置CPU寄存器和外设的寄存器并初始化一些全局变量(只需要调用一次)</div><div class="ttdef"><b>Definition:</b> <a href="bsp__init_8c_source.html#l00029">bsp_init.c:29</a></div></div>
<div class="ttc" id="absp__init_8h_html"><div class="ttname"><a href="bsp__init_8h.html">bsp_init.h</a></div><div class="ttdoc">板级硬件外设初始化</div></div>
<div class="ttc" id="adev__crc_8c_html_af9273c2c56ccb1b14946a43defe57f6b"><div class="ttname"><a href="dev__crc_8c.html#af9273c2c56ccb1b14946a43defe57f6b">crc_init</a></div><div class="ttdeci">void crc_init(void)</div><div class="ttdoc">硬件 CRC 初始化</div><div class="ttdef"><b>Definition:</b> <a href="dev__crc_8c_source.html#l00031">dev_crc.c:31</a></div></div>
<div class="ttc" id="adev__dac_8c_html_a6e622fafee8436bf9cf9f6b120352e3c"><div class="ttname"><a href="dev__dac_8c.html#a6e622fafee8436bf9cf9f6b120352e3c">dac_init</a></div><div class="ttdeci">void dac_init(void)</div><div class="ttdoc">初始化 DAC 模块</div><div class="ttdef"><b>Definition:</b> <a href="dev__dac_8c_source.html#l00148">dev_dac.c:148</a></div></div>
<div class="ttc" id="adev__jpeg_8c_html_a036588013ef5d04b04f06e8ecd22262e"><div class="ttname"><a href="dev__jpeg_8c.html#a036588013ef5d04b04f06e8ecd22262e">jpeg_init</a></div><div class="ttdeci">void jpeg_init(void)</div><div class="ttdoc">初始化 JPEG 硬件解码器模块</div><div class="ttdef"><b>Definition:</b> <a href="dev__jpeg_8c_source.html#l00168">dev_jpeg.c:168</a></div></div>
<div class="ttc" id="adev__systick_8c_html_ac816b9d61dad1fe749c8eb4c625320dd"><div class="ttname"><a href="dev__systick_8c.html#ac816b9d61dad1fe749c8eb4c625320dd">systick_init</a></div><div class="ttdeci">void systick_init(void)</div><div class="ttdef"><b>Definition:</b> <a href="dev__systick_8c_source.html#l00027">dev_systick.c:27</a></div></div>
<div class="ttc" id="adev__uart_8c_html_afd092ef1d390fe16bc90e101bbbca1d8"><div class="ttname"><a href="dev__uart_8c.html#afd092ef1d390fe16bc90e101bbbca1d8">uart_debug_init</a></div><div class="ttdeci">void uart_debug_init(void)</div><div class="ttdoc">初始化用作打印调试日志的串口</div><div class="ttdef"><b>Definition:</b> <a href="dev__uart_8c_source.html#l00103">dev_uart.c:103</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.5
</small></address>
</body>
</html>
